package com.appoint.web.controller.buss;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;

import com.appoint.common.annotation.Anonymous;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.appoint.common.annotation.Log;
import com.appoint.common.core.controller.BaseController;
import com.appoint.common.core.domain.AjaxResult;
import com.appoint.common.enums.BusinessType;
import com.appoint.buss.domain.EpiparaLatest;
import com.appoint.buss.service.IEpiparaLatestService;
import com.appoint.common.utils.poi.ExcelUtil;
import com.appoint.common.core.page.TableDataInfo;

/**
 * LatestController
 *
 * @author appoint
 * @date 2023-01-01
 */
@RestController
@RequestMapping("/buss/latest")
public class EpiparaLatestController extends BaseController
{
    @Autowired
    private IEpiparaLatestService epiparaLatestService;

    /**
     * 查询Latest列表
     */
    @PreAuthorize("@ss.hasPermi('buss:latest:list')")
    @GetMapping("/list")
    public TableDataInfo list(EpiparaLatest epiparaLatest)
    {
        startPage();
        List<EpiparaLatest> list = epiparaLatestService.selectEpiparaLatestList(epiparaLatest);
        return getDataTable(list);
    }

    /**
     * 导出Latest列表
     */
    @PreAuthorize("@ss.hasPermi('buss:latest:export')")
    @Log(title = "Latest", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EpiparaLatest epiparaLatest)
    {
        List<EpiparaLatest> list = epiparaLatestService.selectEpiparaLatestList(epiparaLatest);
        ExcelUtil<EpiparaLatest> util = new ExcelUtil<EpiparaLatest>(EpiparaLatest.class);
        util.exportExcel(response, list, "Latest数据");
    }

    /**
     * 获取Latest详细信息
     */
    @PreAuthorize("@ss.hasPermi('buss:latest:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(epiparaLatestService.selectEpiparaLatestById(id));
    }

    /**
     * 新增Latest
     */
    @PreAuthorize("@ss.hasPermi('buss:latest:add')")
    @Log(title = "Latest", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EpiparaLatest epiparaLatest)
    {
        return toAjax(epiparaLatestService.insertEpiparaLatest(epiparaLatest));
    }

    /**
     * 修改Latest
     */
    @PreAuthorize("@ss.hasPermi('buss:latest:edit')")
    @Log(title = "Latest", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EpiparaLatest epiparaLatest)
    {
        return toAjax(epiparaLatestService.updateEpiparaLatest(epiparaLatest));
    }

    /**
     * 删除Latest
     */
    @PreAuthorize("@ss.hasPermi('buss:latest:remove')")
    @Log(title = "Latest", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(epiparaLatestService.deleteEpiparaLatestByIds(ids));
    }

    @Anonymous
    @GetMapping("/list2")
    public TableDataInfo list2(EpiparaLatest epiparaLatest)
    {
        startPage();
        List<EpiparaLatest> list = epiparaLatestService.selectEpiparaLatestList(epiparaLatest);
        return getDataTable(list);
    }

    @Anonymous
    @GetMapping("/list3")
    public AjaxResult list3()
    {
        List<Map<String, Object>> list = epiparaLatestService.list3();
        return AjaxResult.success(list);
    }

}
